<template>
	<view class="">
		<u-sticky>
			<view class="" style="padding: 0 28rpx;">
				<homeHeader></homeHeader>
			</view>
		</u-sticky>
		<view class="container">
			<view class="row">
				<view class="label">
					发布类型
				</view>
				<view class="value">
					<u--input placeholder="请输入姓名" value="医疗" border="surround" readonly></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					职位名称
				</view>
				<view class="value">
					<u--input placeholder="请输入职位名称" v-model="form.name" border="surround"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					职位描述
				</view>
				<view class="value">
					<u--input placeholder="请输入职位描述" v-model="form.des" border="surround"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					综合薪资
				</view>
				<view class="value">
					<u--input placeholder="请输入综合薪资" v-model="form.salary" border="surround"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					学历要求
				</view>
				<view class="value">
					<u--input placeholder="请输入学历要求" v-model="form.educational" border="surround"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					工作年限
				</view>
				<view class="value">
					<u--input placeholder="请输入工作年限" v-model="form.experience" border="surround"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					年龄要求
				</view>
				<view class="value">
					<u--input placeholder="请输入年龄要求" v-model="form.age" border="surround"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					工作地点
				</view>
				<view class="value">
					<u--input placeholder="请输入工作地点" v-model="form.address" border="surround"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="label">
					联系电话
				</view>
				<view class="value">
					<u--input placeholder="请输入联系电话" v-model="form.phone" border="surround"></u--input>
				</view>
			</view>
			<bottomComponent>
				<view class="bottom-btn" @click="submitHandler">
					发布
				</view>
			</bottomComponent>
		</view>
	</view>

</template>

<script>
	import bottomComponent from "@/components/bottomComponent/index.vue"
	import homeHeader from "@/components/home_header/index.vue"
	import {taskSave} from "@/api/task.js"
	import storage from "@/utils/storage.js"
	
	export default {
		components: {
			bottomComponent,
			homeHeader
		},
		data(){
			return {
				form: {}
			}
		},
		methods: {
			submitHandler(){
				if(!this.form.name){
					uni.showToast({
						title: "请输入岗位名称",
						icon: "none"
					})
					return
				}
				const role_type = storage.get_user_role()
				if(!role_type){
					uni.showToast({
						title: "请切换有权限的角色",
						icon: "none"
					})
					return
				}
				taskSave({
					task_type: "task_medical",
					role_type: role_type,
					...this.form
				})
				.then(res => {
					uni.navigateTo({
						url: "/pages/success/index"
					})
				})
			}
		}
	}
</script>

<style>
	page {
		background: #649CF6 linear-gradient(360deg, #fff 0%, #ECF3FF 60%, #F1F6FF 96%, #F1F6FF 100%);
	}
</style>
<style scoped lang="scss">
	.container {
		margin: 30rpx auto 160rpx;
		width: 730rpx;
		padding: 18rpx 28rpx 28rpx;
		background-color: #fff;
		box-sizing: border-box;

		.row {
			display: flex;
			padding-top: 10rpx;
			align-items: center;

			.label {
				margin-right: 20rpx;
				width: 150rpx;
				text-align: justify;
				text-align-last: justify;
				/*兼容ie*/
				text-justify: distribute-all-lines;
				font-weight: 500;
				font-size: 34rpx;
				color: #000000;
				line-height: 52rpx;
			}
		}

		.row+.row {
			padding-top: 20rpx;
			margin-top: 10rpx;
			border-top: 2rpx solid #F5F5F5;
		}

		.title {
			margin-top: 20rpx;
			font-weight: 500;
			font-size: 34rpx;
			color: #000000;
			line-height: 52rpx;
		}
	}

	.bottom-btn {
		width: 630rpx;
		line-height: 86rpx;
		background: #2B5BF8;
		border-radius: 86rpx;
		font-weight: 500;
		font-size: 38rpx;
		color: #FFFFFF;
		text-align: center;
	}
</style>